﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TireService.Data
{
    public class TireSetLogBLL
    {
        public void CreateTireSetLog(TireServiceDB db, TireSet tireset, DateTime Logdate, int? FromTireSetStatusId, int ToTireSetStatusId, Guid UserId, string Note, decimal? LeftFrontTirePattern, decimal? RightFrontTirePattern, decimal? LeftRearTirePattern, decimal? RightRearTirePattern, int? ContainerCargoRoomId)
        {
            TireSetLog tiresetlog = new TireSetLog();

            tireset.TireSetLogs.Add(tiresetlog);

            tiresetlog.LogDate = Logdate;
            if (FromTireSetStatusId != null) tiresetlog.FromTireSetStatusId = FromTireSetStatusId;
            tiresetlog.ToTireSetStatusId = ToTireSetStatusId;
            if (Note != null) tiresetlog.Note = Note;
            tiresetlog.UserId = UserId;
            if (LeftFrontTirePattern != null) tiresetlog.LeftFrontTirePattern = LeftFrontTirePattern;
            if (LeftRearTirePattern != null) tiresetlog.LeftRearTirePattern = LeftRearTirePattern;
            if (RightFrontTirePattern != null) tiresetlog.RightFrontTirePattern = RightFrontTirePattern;
            if (RightRearTirePattern != null) tiresetlog.RightRearTirePattern = RightRearTirePattern;
            if (ContainerCargoRoomId != null) tiresetlog.ContainerCargoRoomId = ContainerCargoRoomId;

            db.AddTireSetLog(tiresetlog);
        }
    }
}
